import { Controller, UseGuards } from '@nestjs/common';
import { ApiModelProperty, ApiUseTags, ApiBearerAuth } from '@nestjs/swagger';
import { IsNotEmpty, IsUrl } from 'class-validator';
import { Banner } from '@lib/db/models/banner.model';
import { Crud } from 'nestjs-mongoose-crud';
import { AuthGuard } from '@nestjs/passport';
import { InjectModel } from 'nestjs-typegoose';
import { ModelType } from '@typegoose/typegoose/lib/types';

class CreateBannerDto extends Banner {
}


@Crud({
  model: Banner,
  routes: {
    create: {
      dto: CreateBannerDto,
    },
  }
})
@Controller('banners')
@ApiUseTags('轮播图')
@UseGuards(AuthGuard('jwt'))
@ApiBearerAuth()
export class BannersController {
  constructor(
    @InjectModel(Banner) private readonly model: ModelType<Banner>
  ) { }
}
